
import axios from 'axios';

/**
 * 员工
 */
export class StaffService {
    // 分页查询列表
    static findStaffs (queryParams) {
        return axios({
            url: '/restaurant/staff/Staff/findStaffs',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的员工
    static findStaff (staffId) {
        const query = {
            staffId
        }
        return axios({
            url: '/restaurant/staff/Staff/findStaff',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的员工(包含外键名称)
    static findStaffForView (staffId) {
        const query = {
            staffId
        }
        return axios({
            url: '/restaurant/staff/Staff/findStaffForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的员工(包含外键名称)
    static findStaffForEdit (staffId) {
        const query = {
            staffId
        }
        return axios({
            url: '/restaurant/staff/Staff/findStaffForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的员工(只提取ID 和 Name)
    static findStaffsWithIdNameById (staffId) {
        const query = {
            staffId
        }
        return axios({
            url: '/restaurant/staff/Staff/findStaffsWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询员工集合(只提取ID 和 Name)
    static findStaffsWithIdNameByName (staffName) {
        const query = {
            staffName
        }
        return axios({
            url: '/restaurant/staff/Staff/findStaffsWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存员工
    static saveStaff (staff) {
        const query = {}
        return axios({
            url: '/restaurant/staff/Staff/saveStaff',
            method: 'POST',
            params: query,
            data: staff
        });
    }

    //修改保存员工
    static updateStaff (staff) {
        const query = {}
        return axios({
            url: '/restaurant/staff/Staff/updateStaff',
            method: 'POST',
            params: query,
            data: staff
        });
    }

    //根据ID查询指定的员工(只提取ID 和 Name)
    static deleteStaff (staffId) {
        const query = {
            staffId
        }
        return axios({
            url: '/restaurant/staff/Staff/deleteStaff',
            method: 'POST',
            params: query,
        });
    }

    static generateUser(staffs) {
      const query = {  }
      return axios({
        url: '/restaurant/staff/Staff/generateUser',
        method: 'POST',
        params: query,
        data:staffs
      });
    }
}
